//2009/08/18 22:09:23
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <sstream>
#include <algorithm>

using namespace std;

class RunLengthEncoding
{
public:
    string decode(string text)
    {
        string s;
        int sz = 0;
        for (int i=0; i<text.size(); i++)
        {
            if (isdigit(text[i]))
            {
                sz = sz * 10 + (text[i] - '0');
				if(sz > 50) return "TOO LONG";
            }
			else
			{
				if(sz == 0) sz = 1;
				string temp(sz, text[i]);
				s += temp;
				sz = 0;
			}
        }
		if(s.size() > 50) return "TOO LONG";
        return s;
    }
};
//tourist.
